﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.ProjectBuyRecord
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.ProjectBuyRecord;

    public class ProjectDocumentBuyRecord_Map : ClassMapping<ProjectDocumentBuyRecord>
    {
        public ProjectDocumentBuyRecord_Map()
        {
            //映射ID
            Id(x => x.buy_id, map => map.Length(40));

            Property(x => x.is_valid);
            Property(x => x.create_date);

            Property(x => x.buy_code, map => map.Length(50));
            Property(x => x.buy_date);
            Property(x => x.buy_ent_user_name, map => map.Length(50));
            Property(x => x.buy_flag);
            Property(x => x.buy_fphm, map => map.Length(50));
            Property(x => x.buy_pp, map => map.Length(500));

            Property(x => x.buy_value);

            //所属标书
            ManyToOne(x => x.document, map =>
            {
                map.Column("doc_id");
            });

            //所属投标人企业
            ManyToOne(x => x.enterprise, map =>
            {
                map.Column("buy_ent_id");
            });

            //所属投标人企业的联系人
            ManyToOne(x => x.enterprise_linker, map =>
            {
                map.Column("buy_ent_user_id");
            });

            Property(x => x.order_date);

            //购买记录操作员
            ManyToOne(x => x.order_user, map =>
            {
                map.Column("op_user_id");
            });

            //购买记录收款员
            ManyToOne(x => x.buy_user, map =>
            {
                map.Column("buy_user_id");
            });

            Table("t_document_buy_record");

            //不进行创建
            //SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
